/**
 * @param {Object} unusual 异常监控
 * @param {Object} performance 性能监控
 * @param {Object} log 日志监控
 * @param {Object} dqualityData 数据质量监控
 */
const unusual = [
  {
    title: '编号',
    width: 60,
    align: 'center',
    type: 'index'
  },
  {
    title: '异常时间',
    width: 130,
    align: 'center',
    key: 'collectionLogTime'
  },
  {
    title: '异常类型',
    align: 'center',
    render: (h, params) => {
      return h('Tooltip', { attrs: { placement: 'top', content: `${params.row.typeId}` } }, params.row.typeId)
    }
  },
  {
    title: '服务器IP',
    width: 150,
    align: 'center',
    key: 'collectorIp'
  },
  {
    title: '异常描述',
    align: 'center',
    render: (h, params) => {
      return h('Tooltip', { attrs: { placement: 'top', content: `${params.row.logInformation}` } }, params.row.logInformation)
    }
  }
]

const performance = [
  {
    title: '编号',
    width: 60,
    align: 'center',
    type: 'index'
  },
  {
    title: '时间',
    width: 130,
    align: 'center',
    key: 'crawlTime'
  },
  {
    title: 'IP',
    align: 'center',
    render: (h, params) => {
      return h('Tooltip', { attrs: { placement: 'top', content: `${params.row.ip}` } }, params.row.ip)
    }
  },
  {
    title: '内存占用率',
    width: 100,
    align: 'center',
    render: (h, params) => {
      const ratio = params.row.ratio
      if (ratio > 100) ratio = 100
      return ratio > 0 ? h('span', `${ratio}%`) : h('span', ratio)
    }
  },
  {
    title: '并发数',
    width: 80,
    align: 'center',
    key: 'concurrentno'
  },
  {
    title: '爬取速率(s)',
    width: 100,
    align: 'center',
    render: (h, params) => {
      const crawlerratio = params.row.crawlerratio
      if (crawlerratio > 100) crawlerratio = 100
      return crawlerratio > 0 ? h('span', `${crawlerratio}%`) : h('span', crawlerratio)
    }
  }
]

const log = [
  {
    title: '编号',
    width: 60,
    align: 'center',
    type: 'index'
  },
  {
    title: '时间',
    width: 140,
    align: 'center',
    key: 'collectionLogTime'
  },
  {
    title: 'IP',
    align: 'center',
    render: (h, params) => {
      return h('Tooltip', { attrs: { placement: 'top', content: `${params.row.collectorIp}` } }, params.row.collectorIp)
    }
  },
  {
    title: '任务名称',
    align: 'center',
    render: (h, params) => {
      return h('Tooltip', { attrs: { placement: 'top', content: `${params.row.taskName}` } }, params.row.taskName)
    }
  },
  {
    title: '日志类型',
    width: 80,
    align: 'center',
    key: 'typeId'
  },
  {
    title: '请求Url',
    align: 'center',
    render: (h, params) => {
      return h('Tooltip', { attrs: { placement: 'top', content: `${params.row.collectionUrl}` } }, params.row.collectionUrl)
    }
  },
  {
    title: '日志等级',
    width: 100,
    align: 'center',
    key: 'logRank'
  },
  {
    title: '日志信息',
    align: 'center',
    render: (h, params) => {
      return h('Tooltip', { attrs: { placement: 'top', content: `${params.row.logInformation}` } }, params.row.logInformation)
    }
  }
]

const dqualityData = [
  {
    title: '编号',
    width: 60,
    align: 'center',
    type: 'index'
  },
  {
    title: '清洗时间',
    width: 130,
    align: 'center',
    key: 'cleanTime'
  },
  {
    title: '任务名称',
    width: 100,
    align: 'center',
    key: 'taskName'
  },
  {
    title: '模型名称',
    align: 'center',
    render: (h, params) => {
      return h('Tooltip', { attrs: { placement: 'top', content: `${params.row.moduleName}` } }, params.row.moduleName)
    }
  },
  {
    title: '采集时间',
    width: 130,
    align: 'center',
    key: 'crawlTime'
  },
  {
    title: '采集Url',
    align: 'center',
    render: (h, params) => {
      return h('Tooltip', { attrs: { placement: 'top', content: `${params.row.url}` } }, params.row.url)
    }
  },
  {
    title: '采集器IP',
    width: 110,
    align: 'center',
    key: 'ip'
  },
  {
    title: '描述信息',
    align: 'center',
    render: (h, params) => {
      return h('Tooltip', { attrs: { placement: 'top', content: `${params.row.msg}` } }, params.row.msg)
    }
  }
]
export { unusual, performance, log, dqualityData }
